//
//  Canvas.hpp
//  RayTracer
//
//  Created by 俞云康 on 2/15/16.
//  Copyright © 2016 yushroom. All rights reserved.
//

#ifndef Canvas_hpp
#define Canvas_hpp

#include "RenderFish.hpp"
#include "Math.hpp"
#include "Color.hpp"
#include <vector>
#include <string>

class Canvas {
public:
    int m_width, m_height;
    std::vector<Color> pixels;
    
    static Canvas create(const Params& params);
    
    Canvas() = default;
    Canvas(int width, int height) : m_width(width), m_height(height), pixels(width*height) {}
    
	void write(const std::string& path);
    
    void clear() {
        memset(pixels.data(), 0, pixels.size()*sizeof(pixels[0]));
    }

	float getAspect() const {
		return float(m_width) / m_height;
	}
};

#endif /* Canvas_hpp */
